import logging, os
from .cell import run_cell, run_cell_list
from .report import run_report

logging.basicConfig(level=logging.DEBUG, format='[%(levelname)s] %(asctime)s %(message)s')
logger = logging.getLogger('NextApp-ONT-QC')


def run_ontqc(args):
    if args.type == 'cell':
        run_cell(args.input, args.qscore_cutoff, args.distribution_step, args.distribution_endpoint, args.thread)
    elif args.type == 'list':
        run_cell_list(args.input, args.qscore_cutoff, args.distribution_step, args.distribution_endpoint, args.thread)
    else:
        if not os.path.exists(args.outdir): os.makedirs(args.outdir)
        run_report(args.input, args.outdir, args.project, args.sample, args.writer, args.verifier)
